<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@page import="support.*, java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Address</title>
</head>
<body>
	<h1>Address</h1>
		<%
			student stu = (student)session.getAttribute("student");
		
			String firstName = (String)stu.getAttribute("firstName");
		    String lastName = (String)stu.getAttribute("lastName");
			String middleName = (String)stu.getAttribute( "middleName" );
			String citizenship = (String)stu.getAttribute( "citizenship" );
			String residence = request.getParameter( "residence" );
			stu.setAttribute("residence",residence);
			
			session.setAttribute("student", stu);
		%>
	<h2><%= firstName + " " + middleName + " " + lastName%></h2>
	<h2><%= "Citizenship: " + citizenship%></h2>
	<h2><%= "Residence: " + residence %> </h2>
	
	<!-- US address -->	
	<%
	if (residence.equals("United States")&& citizenship.equals("United States")){
	%>
		<form method="GET" action="location.jsp">
			<p>Street Address: <input type="text" name="street"/ size ="30"> </p>
		    <p>City: <input type="text" name="city"/></p> 
		    <p>State: <input type="text" name="state"/ size = "2"> </p>
		    <p>Zip Code: <input type="text" name="zipCode"/ size = "5"></p>
		    <p>Phone Number: <input type="text" name="phone"/ size = "5"></p>
	    <input type="submit" value="Click to Submit"/>
	    </form>
	<%   
	}else if(residence.equals("United States") && !(citizenship.equals("United States"))){
	%>
	    <form method="GET" action="location.jsp">
			<p>Street Address: <input type="text" name="street"/ size ="30"></p>
		    <p>City: <input type="text" name="city"/> </p>
		    <p>State: <input type="text" name="state"/ size = "2"></p> 
		    <p>Zip Code: <input type="text" name="zipCode"/ size = "5"></p>
		    <p>Phone Number: <input type="text" name="phone"/ size = "5"> </p>
	    <input type="submit" value="Click to Submit"/>
	    </form>
	    
	 <%   
	}else{
	 %>
    <!--  Non US address -->
    <form method="GET" action="residency.jsp">
	    Street Address: <input type="text" name="street"/> <p />
	    City: <input type="text" name="city"/> <p />
	    <p>Phone Number: <input type="text" name="phone"/ size = "5"> </p>
	    Country Telephone Code: <input type="text" name="phoneCode"/ size = "4"> <p />
    <input type="submit" value="Click to Submit"/>
    </form>
	
	<%
	}
	%>
	
</body>
</html>